<template>
    <keep-alive>
      <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
          <el-form-item label="活动名称" prop="qyyxAcName">
            <el-input
              v-model="queryParams.qyyxAcName"
              placeholder="请输入活动名称"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
  
        <el-table v-loading="loading" border stripe :data="activityList" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="活动名称" align="center" prop="qyyxAcName" />
          <!-- <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['qyyx:activity:edit']"
              >修改</el-button>
              <el-button
                size="mini"
                type="text"
                @click="toEwm(scope.row)"
              >管理二维码</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['qyyx:activity:remove']"
              >删除</el-button>
            </template>
          </el-table-column> -->
        </el-table>
  
        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
  
      </div>
    </keep-alive>
  
  </template>
  
  <script>
  
  export default {
    name: "ActivityCust",
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 总条数
        total: 0,
        // 全员营销活动信息表格数据
        activityList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 是否有效字典
        isActiveOptions: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
        }
      };
    },
    created() {
      // this.getList();
      this.getDicts("is_active").then(response => {
        this.isActiveOptions = response.data;
      });
    },
    activated(){
      this.getList();
    },
    methods: {
      /** 查询全员营销活动信息列表 */
      getList() {
        this.loading = true;
        listActivity(this.queryParams).then(response => {
          this.activityList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.id)
        this.single = selection.length!=1
        this.multiple = !selection.length
      },
    }
  };
  </script>
  